<template>
	<view class="p_bg_all p_b_128">
		<noneData noneTitle="暂无数据~" v-if="listData.length === 0"></noneData>
		<view class="p_lr_32 p_over" v-else>
			<view class="list_wrapper" v-for="item in listData" :key="item.id">
				<view class="p_flex p_margin_b_18">
					<view class="p_flex_2 p_font_32 p_one_text">{{item.order_num}}</view>
					<image src="https://dy.sykj365.com/uploads/mini/youjiantou@2x.png" class="p_img_48 p_margin_l_30"></image>
				</view>
				<view class="p_font_28 p_flex5">
					<view class="p_color_7a p_margin_r_140">抬头</view>
					<view class="p_flex_1" style="text-align: right;">{{item.look_up}}</view>
				</view>
				<view class="p_font_28 p_flex9 p_margin_t_8">
					<view class="p_color_7a">开票金额</view>
					<view>{{item.total_price}}元</view>
				</view>
				<view class="p_font_28 p_flex9 p_margin_t_8" v-if="item.invoice_time">
					<view class="p_color_7a">开票时间</view>
					<view>{{item.invoice_time}}</view>
				</view>
				<view class="p_font_28 p_flex9 p_margin_t_8">
					<view class="p_color_7a">开票状态</view>
					<view class="p_color_05b570" v-if="item.invoice == 2">已开</view>
					<view class="p_color_ff5555" v-if="item.invoice == 1">未开</view>
				</view>
			</view>
		</view>
		<view class="p_bottom_fix">
			<navigator url="/pages/my/addInvoice" hover-class="none" class="p_btn">
				<view>我要开票</view>
			</navigator>
		</view>
	</view>
</template>

<script>
	import noneData from '../../components/noneData.vue';

	export default {
		components: {
			noneData
		},
		data() {
			return {
				listData: []
			}
		},
		onLoad() {
			this.getListData();
		},
		onShow() {
			if(uni.getStorageSync('invoice')) {
				this.getListData();
				uni.removeStorageSync('invoice');
			}
		},
		methods: {
			getListData() {
				this.$http.post(this.$api.invoiceRecord).then(res => {
					this.listData = res.data;
				})
			}
		}
	}
</script>

<style lang="less">
	.list_wrapper {
		padding: 32rpx;
		margin: 32rpx 0;
		border-radius: 16rpx;
		background-color: #fff;
	}
</style>